package com.sentrix.auto.printercenter.infrastructure.agentserver.dto;

import cn.hutool.core.util.EnumUtil;
import cn.hutool.core.util.StrUtil;
import lombok.Data;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

@Data
public class PinterJobMsg extends PrinterStatusMsg{
    private String jobId;
    private String jobName;


    @Getter
    public enum JOB_STATUS{
        SPOOLING("SPOOLING", "sending"),
        PRINTING("PRINTING", "printing"),
        RETAINED("RETAINED", "task remain"),
        COMPLETE("COMPLETE", "task complete"),
        DELETING("DELETING", "task clean"),
        DELETED("DELETED", "task delete"),
        FAILED("FAILED", "task fail");
        private String code;
        private String desc;
        JOB_STATUS(String code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static JOB_STATUS getByCode(String code){
            return EnumUtil.getBy(JOB_STATUS.class, e-> StrUtil.equalsIgnoreCase(e.getCode(), code));
        }
    }
}
